package com.zz.ecommerce.declareManage.importB2CDeclareDirect.orderManageInsp;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.bean.insp.db.order.TOrderHeadInsp;
import com.zz.ecommerce.common.constants.CommonConstant;
import com.zz.ecommerce.common.constants.DictConstants;
import com.zz.ecommerce.common.constants.TableConstants;
import com.zz.ecommerce.declareManage.common.dao.TOrderHeadInspDao;
import com.zz.ecommerce.utils.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Created by steven on 2016/3/28.
 */
@Controller
@RequestMapping("/importB2CDirect/orderManageInsp")
public class InspIB2cDirectOrderController {

    @Autowired
    private TOrderHeadInspDao tOrderHeadInspDao;

    @RequestMapping("/init")
    public String init() {
        return "declareManage/importB2CDeclareDirect/orderManageInsp/index";
    }

    @RequestMapping("/queryOrderList")
    @ResponseBody
    public GridResult queryOrderList(TOrderHeadInsp tOrderHeadInsp, GridRequest request, HttpSession session) {
        tOrderHeadInsp.setOrgId(SessionUtil.getOrganizationId(session));
        tOrderHeadInsp.setIetype(DictConstants.IMPORT);
        tOrderHeadInsp.setBiztype(CommonConstant.BIZ_TYPE_DIRECT);
        return new GridResult(tOrderHeadInspDao.page(TableConstants.T_ORDER_HEAD_INSP, tOrderHeadInsp, request.getStart(), request.getEnd(), request.getSortOrder()), request, tOrderHeadInspDao.count(TableConstants.T_ORDER_HEAD_INSP, tOrderHeadInsp));
    }
}
